package swag.t;

import java.util.ArrayList;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.widget.EditText;
import android.widget.Toast;

public class Ball 
{
private int x,y,radius,color,health,speed,regen,power;

private float xvel, yvel;

private Bitmap img;

private Context cxt;

public int lives=3;



EditText editText1;

boolean istouchingpixel;
public Ball(int x, int y, float xvel, float yvel, int color, int radius, Context context, int Lives, int Drawable)

{
this.x = x;
this.y =y;
this.cxt = context;
this.color = color;
this.xvel = xvel;
this.yvel = yvel;
this.radius = radius;
this.lives = Lives;

BitmapFactory.Options ops = new BitmapFactory.Options();
ops.inJustDecodeBounds = true;
Bitmap temp = BitmapFactory.decodeResource(context.getResources(),Drawable);
img=Bitmap.createScaledBitmap(temp, radius * 2, radius * 2, false);

}

public Bitmap getImage()
{
	return img;
	
}

public void setlives(int newlives)
{
	lives = newlives;
}
public ArrayList<Pixel> move(float f, float g, ArrayList<Pixel> PixelList)
{
	ArrayList<Pixel> remove1 = new ArrayList<Pixel>();
	
	//System.out.println(img.getWidth());
	if(x-radius<=0 || (x+ radius)>=450)
	{
		xvel = -xvel;
	}
	if(y-radius<=0 || (y+ radius)>=800)
	{
		yvel = -yvel;
	}
	
	//x+=xvel;
	//y+=yvel;
	
	

		for(int i = 0; i<PixelList.size(); i++)
		{
					if(Math.abs(PixelList.get(i).getx()-x)<(radius + 12) && Math.abs(y-PixelList.get(i).gety())<(radius+12))
		{  
			if(istouchingpixel == false)
			{
			istouchingpixel = true;
			
			remove1.add(PixelList.get(i));
			
			}
		}
		else
		{
			istouchingpixel = false;
		}
		}
		return remove1;

	}


public void setX(int x2)
{
 x =x2;	
}

public void setY(int y2)
{
y = y2;
}

public void setRadius(int radius2)
{
	radius = radius2;
}

public int getradius()
{
return radius;
}

public int gety()
{
	return y;
}

public int getx()
{ return x;
}

public void sethealth(int health2)
{
	health = health2;
}

public int gethealth()
{
	return health;
}

public void setspeed(int speed2)
{
	speed = speed2;
}

public int getspeed()
{
	return speed;
}

public void setregen(int regen2)
{
	regen = regen2;
}

public int getregen()
{
	return regen;
}

public void setpower(int power2)
{
	power = power2;
}

public int getpower()
{
	return power;
}


public void setxvel(float xvel2)
{
	 xvel = xvel2;
}
public float getxvel()
{
	return xvel;
}
public void setyvel(float yvel2)
{yvel = yvel2;
}

public float getyvel()
{
	return yvel;
}
public void setcolor(int color2)
{
	color = color2;
}

public int getcolor()
{
	return color;
}

public void loselife() {
	// TODO Auto-generated method stub
	
	lives--;
if(lives<=0)
{
	
}
}

public int getLives(){
	return lives;
}





}





